package cn.swust.designpatternlearningplatform.domain.bo;

import lombok.Data;
import lombok.Setter;
import lombok.ToString;

import java.math.BigDecimal;
import java.util.Arrays;

/**
 * 试卷参数（用于智能组卷）
 *
 * @author Tang
 * @date 2023/5/16 16:30
 **/
@ToString
public class PaperParamBo {
    /**
     * 各题型的分数
     * 0-每道判断题的分数
     * 1-每道选择题的分数
     * 2-每道多选题的分数
     * 3-每道简答题的分数
     *
     * @author Tang
     * @date 2023/5/17 11:17
     **/
    private final BigDecimal[] eachScore = new BigDecimal[4];
    /**
     * 各题型的数目
     * 0-每道判断题的数目
     * 1-每道选择题的数目
     * 2-每道多选题的数目
     * 3-每道简答题的数目
     *
     * @author Tang
     * @date 2023/5/17 11:24
     **/
    private final Integer[] eachNum = new Integer[4];

    /**
     * 试卷难度系数期望
     *
     * @author Tang
     * @date 2023/5/16 16:34
     **/
    private BigDecimal expectedDifficulty;
    /**
     * 试卷知识点覆盖率期望
     *
     * @author Tang
     * @date 2023/5/16 16:34
     **/
    private BigDecimal expectedKnowledgePointCoverage;
    /**
     * 试卷区分度期望（默认0.35）
     *
     * @author Tang
     * @date 2023/5/16 16:35
     **/
    private BigDecimal expectedDifferentiation = BigDecimal.valueOf(0.35);

    public PaperParamBo() {
        Arrays.fill(this.eachScore, BigDecimal.ZERO);
        Arrays.fill(this.eachNum, 0);
    }

    /**
     * 计算该试卷的总分
     *
     * @return java.math.BigDecimal
     * @author Tang
     * @date 2023/5/16 23:59
     **/
    public BigDecimal getTotalScore() {
        BigDecimal sum = BigDecimal.ZERO;
        for (int i = 0; i < eachNum.length; i++) {
            sum = sum.add(eachScore[i].multiply(BigDecimal.valueOf(eachNum[i])));
        }
        return sum;
    }

    public void setEachJudgeScore(BigDecimal eachJudgeScore) {
        this.eachScore[0] = eachJudgeScore;
    }

    public void setEachChoiceScore(BigDecimal eachChoiceScore) {
        this.eachScore[1] = eachChoiceScore;
    }

    public void setEachMultipleChoiceScore(BigDecimal eachMultipleChoiceScore) {
        this.eachScore[2] = eachMultipleChoiceScore;
    }

    public void setEachShortAnswerQuestionScore(BigDecimal eachShortAnswerQuestionScore) {
        this.eachScore[3] = eachShortAnswerQuestionScore;
    }

    public BigDecimal[] getEachScore() {
        return eachScore;
    }

    public void setJudgeNum(Integer judgeNum) {
        this.eachNum[0] = judgeNum;
    }

    public void setChoiceNum(Integer choiceNum) {
        this.eachNum[1] = choiceNum;
    }

    public void setMultipleChoiceNum(Integer multipleChoiceNum) {
        this.eachNum[2] = multipleChoiceNum;
    }

    public void setShortAnswerQuestionNum(Integer shortAnswerQuestionNum) {
        this.eachNum[3] = shortAnswerQuestionNum;
    }

    public BigDecimal getEachJudgeScore() {
        return eachScore[0];
    }

    public BigDecimal getEachChoiceScore() {
        return eachScore[1];
    }

    public BigDecimal getEachMultipleChoiceScore() {
        return eachScore[2];
    }

    public BigDecimal getEachShortAnswerQuestionScore() {
        return eachScore[3];
    }

    public Integer getJudgeNum() {
        return eachNum[0];
    }

    public Integer getChoiceNum() {
        return eachNum[1];
    }

    public Integer getMultipleChoiceNum() {
        return eachNum[2];
    }

    public Integer getShortAnswerQuestionNum() {
        return eachNum[3];
    }

    public BigDecimal getExpectedDifficulty() {
        return expectedDifficulty;
    }

    public BigDecimal getExpectedKnowledgePointCoverage() {
        return expectedKnowledgePointCoverage;
    }

    public BigDecimal getExpectedDifferentiation() {
        return expectedDifferentiation;
    }

    public void setExpectedDifficulty(BigDecimal expectedDifficulty) {
        this.expectedDifficulty = expectedDifficulty;
    }

    public void setExpectedKnowledgePointCoverage(BigDecimal expectedKnowledgePointCoverage) {
        this.expectedKnowledgePointCoverage = expectedKnowledgePointCoverage;
    }

    public void setExpectedDifferentiation(BigDecimal expectedDifferentiation) {
        this.expectedDifferentiation = expectedDifferentiation;
    }
}
